import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteMockServe } from 'vite-plugin-mock'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig(({command}) => {
  return (
    {
      plugins: [
        vue(),
        viteMockServe({
          // default
          mockPath: 'mock',
          localEnabled: command === 'serve',
        }),
      ],
      resolve: {
        extensions: ['.vue', '.js'],
        alias: {
          '@': path.join(__dirname, 'src'),
        },
      },
      server: {
        open: true,
      },
    }
  )
})
